package com.hengpeng.itfin.job;

import java.util.Date;

import com.hengpeng.common.cis.ComponentContextLoader;
import com.hengpeng.common.scheduling.AbstractJob;
import com.hengpeng.common.scheduling.ScheduleConfig;
import com.hengpeng.common.util.DateTimeUtil;
import com.hengpeng.itfin.service.ServiceFactory;
/**
 * <pre>
 * 还款对账定时作业
 * </pre>
 * @author weiyuan
 * @version 1.0, 2015年7月19日
 */
public class RepaymentReconciliationJob extends AbstractJob
{
	public final static int pageSize = 500;//每页显示记录数量
	
	public final static int dayRangeForward = 5;//向前查询范围
	
	public final static int dayRangeBack = -5;//向后查询范围
	
	public final static int initPageNum = 1;//初始页数
	
	@Override
	public void exec(boolean isTimeout, ScheduleConfig config)
	{
		log.info("还款对账定时作业开始,时间：" + DateTimeUtil.formatToStr(new Date(), DateTimeUtil.DATE_FORMAT_YMDHMS) );
		ServiceFactory serviceFactory = ComponentContextLoader.getBean(ServiceFactory.class);
		Date beginDate = DateTimeUtil.addDate(new Date(), dayRangeForward);
		Date endDate = DateTimeUtil.addDate(new Date(), dayRangeBack);
		
		serviceFactory.getRepaymentService().repaymentReconciliation(initPageNum, pageSize,beginDate, endDate);
		log.info("还款对账定时作业开始,时间：" + DateTimeUtil.formatToStr(new Date(), DateTimeUtil.DATE_FORMAT_YMDHMS) );
	}
}
